Extract Traverser from UtBotSymbolicEngine#307
Merged
sergeypospelov merged 19 commits intomainfrom Jul 8, 2022
Merged
Conversation
8b50bb2 to
f7359f3
Compare
sergeypospelov
commented
Jun 27, 2022
sergeypospelov
commented
Jun 27, 2022
utbot-framework/src/main/kotlin/org/utbot/engine/TraversalContext.kt
Outdated
Show resolved
Hide resolved
sergeypospelov
commented
Jun 27, 2022
sergeypospelov
commented
Jun 27, 2022
CaelmBleidd
requested changes
Jun 28, 2022
utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/UtBotTestCaseGenerator.kt
Show resolved
Hide resolved
utbot-framework/src/main/kotlin/org/utbot/engine/TraversalContext.kt
Outdated
Show resolved
Hide resolved
f7359f3 to
f6bca78
Compare
6679597 to
5274326
Compare
nikitavlaev
approved these changes
Jul 7, 2022
Member
nikitavlaev
left a comment
There was a problem hiding this comment.
Checked force mocks: no regression so far.
dtim
approved these changes
Jul 7, 2022
utbot-framework/src/main/kotlin/org/utbot/engine/ExecutionState.kt
Outdated
Show resolved
Hide resolved
CaelmBleidd
approved these changes
Jul 7, 2022
Convert Traversal functions to extension functions
5274326 to
33c61d1
Compare
EgorkaKulikov
approved these changes
Jul 8, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Split the logic of
UtBotSymbolicEngineinto two classes:UtBotSymbolicEngineTraverserIntroduced new classes and some TODO stubs:
StateLabelis used for markingExecutionStateaccordingly to their status (INTERMIDIATE, CONCRETE, TERMINAL). See the comments in the code for more information.TraversalContextis a context during one Jimple instruction traversal. Now there are some TODO stubs for the future work.Refactored several relevant places with non-functional changes:
SymbolicResultinprocessResultFixes #259
Details
Previously
UtBotSymbolicEnginehad the complex logic of different types:The idea is to split some of the aspects of the engine logic into different classes. In this MR the extraction of Jimple traversal was done. Now we have two classes:
UtBotSymbolicEngine
Now
UtBotSymbolicEngineis a manager class. It's created once for one method analysis process. We can't reuse it for different methods. It sets up everything forTraverser, controls the flow of polling states from the queue and pushing new states to the queue and also processes terminal states.So now the next things are done in
UtBotSymbolicEngine:Traverser
Traverseris responsible for traversing the top instruction from the passedExecutionState. It's created insideUtBotSymbolicEngineand can't be reused between different methods ("method-under-test"s). The main function istraverse(state: ExecutionState): Collection<ExecutionState>which takes anExecutionStateand produces next states, so all other extra information needed for traversal should be passed via the constructor ofTraverser.Please note, that now it's
Traverserresponsibility to choose the right label for the nextExecutionState. ThenUtBotSymbolicEnginematches on this label and decides what to do with this state.So now the next things are done in
Traverser:Type of Change
How Has This Been Tested?
Automated Testing
Ran all tests in IDEA. No new test failures have been detected in this change.
Checklist: